import request, { normalRequest } from '@/utils/request';



export async function codeHelperPojo2Json(randomInit, data) {
  return request(`/common/code/helper/pojo2Json?randomInit=${randomInit}`, {
    method: 'POST',
    data: data
  });
}


export async function getImageCaptcha() {
  return request('/user/captcha/image', {
    method: 'POST'
  });
}

export async function sendMailCaptcha(data) {
  return request('/user/captcha/email', {
    method: 'POST',
    data: data
  });
}

export async function getOssSignature(dir) {
  return request('/common/oss/signature', {
    method: "POST",
    data: {
      dir: dir
    }
  })
}

export async function ossUploadFile(endpointUrl, formData) {
  return normalRequest(endpointUrl, {
    method: "POST",
    requestType: 'form',
    data: formData,
    responseType: "text"
  })
}

export async function localUploadFile(formData) {
  return request('/common/file/upload', {
    method: "POST",
    requestType: 'form',
    data: formData,
  })
}